﻿#ifndef VIDEORENDERER_H
#define VIDEORENDERER_H

#include <QQuickImageProvider>
#include <QOpenGLTexture>
#include <QImage>
#include <QMutex>

class VideoRenderer : public QObject, public QQuickImageProvider {
    Q_OBJECT
public:
    VideoRenderer();

    QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
    QQuickTextureFactory* requestTexture(const QString &id, QSize *size, const QSize &requestedSize) override;

public slots:
    void updateFrame(const QImage &frame);

signals:
    void textureUpdated();

private:
    QImage m_currentFrame;
    QMutex m_frameMutex;
};

#endif // VIDEORENDERER_H
